cc.Class({
    extends: cc.Component,
 
    properties: {
        m_loadingMax:{
            default:500,
            type:cc.Integer,
        },
        m_Speed:{
            default:0.1,
            type:cc.Integer},
        m_loadingIm:cc.Node,
    },
    ctor:function(){
        this.m_progressIng=false;
    },
    onLoad () {
        this.m_loadingIm.getComponent(cc.Sprite).fillRange = 0;//进度条初始值
    },
    setProgress:function(pro){
        if(pro >1 || pro <0){
            return;
        }
        var width =1 * pro;
        if(width<1){
            return;
        }
        this.m_progressIng=true;   //只有这次比上一次更长m_progressIng才=true
 
    },	
    update (dt) {
        if(this.m_progressIng){//模拟进度条加载
            if(this.m_loadingIm.getComponent(cc.Sprite).fillRange < 1){
                this.m_loadingIm.getComponent(cc.Sprite).fillRange += 0.01;
            }if(this.m_loadingIm.getComponent(cc.Sprite).fillRange>=this.m_loadingMax){
                this.m_progressIng=false;
                if(this.finishCallBack!=null){  //防止空函数调用
                    this.finishCallBack();
                }
            }
        }
       
    },
});
 
